#ifndef ACCOUNTMANAGER_H_INCLUDED
#define ACCOUNTMANAGER_H_INCLUDED

//(* wxWidgets includes
#include <wx/notebook.h>
#include <wx/string.h>
#include <wx/arrstr.h>
//*)

//(* C/C++ includes
#include <map>
//*)

//(* other includes
#include "../common/IPlugin.h"
#include "../common/stdafx.h"
//#include "Account.h"
#include "MySql/MySqlEmbeddedWrapper.h"
//*)

//(* defines
typedef std::map<size_t, size_t>           ACCOUNT_ID_MAP; // <ID, Page Number>
typedef std::map<size_t, size_t>::iterator ACCOUNT_ID_MAP_ITER;
//*)

//(* constants
//*)

class CMainFrame;
class CAccount;

class CAccountManager : public wxNotebook
{
public:
    CAccountManager(CMainFrame* pParent, wxWindowID ID, CMySqlWrapper* pMySql);
    ~CAccountManager();
    int LoadAccounts();
    bool GetNextAccountFromResultSet(SAccountInfo& Account);
    bool AddAccount(SAccountInfo& AccountInfo, CAccountPlugin* pPlugin, const bool IsNewAccount = false);
    bool CreateFirstAccount(const SUserInfo& User);
    bool EditAccount(SAccountInfo& AccountInfo, const bool CanEdit, const bool IsNewAccount);
    void CreateAccountFileName(SAccountInfo& AccountInfo, const bool ReplaceCurrentFileName);
    CAccount* GetAccount(size_t AccountID);
    bool UpdateAccount(SAccountInfo& AccountInfo);
    void SetAccountTabText(const SAccountInfo& AccountInfo);

private:
    CMainFrame*          m_pParent;
    CMySqlWrapper*       m_pMySql;
    ACCOUNT_ID_MAP       m_AccountIDs;
};

#endif // ACCOUNTMANAGER_H_INCLUDED
